package adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.juyuanapp.R;
import com.example.juyuanapp.bean.BookBean;

import java.util.List;

public class MyAdapter extends BaseAdapter {
    private List<BookBean.DataBean> mlist;
    private Context mContext;

    public MyAdapter(Context mContext,List<BookBean.DataBean> mlist){
        this.mContext = mContext;
        this.mlist = mlist;
    }
    @Override
    public int getCount() {
        return mlist.size();
    }

    @Override
    public Object getItem(int position) {
        return mlist.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = View.inflate(mContext, R.layout.booklist,null);

        TextView booklist = view.findViewById(R.id.tv_kaoya);
        booklist.setText(mlist.get(position).getName());
        return view;
    }
}
